<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <%- @view_title = "Edit Stage" -%>
  <%- @current_tab_name = "admin" -%>
  <%= render :partial => "shared/head" %>
</head>
<body id="<%= page_name %>" class="<%= page_name %>" <%= render "shared/body_data_attrs" %>>
<div class="page-wrap">
  <div id="body_bg">
    <%= render :partial => "shared/header" %>

    <div id='body_content'>
      <div class="messaging_wrapper" id="messaging_wrapper">
        <%= render :partial => "shared/flash_message" %>
        <%= render :partial => "shared/config_save_actions", :locals => {:scope => {}} -%>
      </div>

      <%= render :partial => 'layouts/pipelines/breadcrumb_top' %>

      <%= content_wrapper_tag %>
      <div class="row">
        <div class="admin_wrapper">
          <div class="admin_sidebar general">
            <%= render :partial => "admin/shared/pipeline_tree.html", :locals => {:scope => {:pipeline => @pipeline}} %>
          </div>
          <div class="admin_workspace has_tree_view">
            <div class="pipeline_header">
              <h3 class="title entity_title">
                <%= link_to @pipeline.name(), pipeline_edit_path(:pipeline_name => params[:pipeline_name], :current_tab => 'general'), :class => 'wrapped_word' %> &raquo; <%= @stage.name() -%>
              </h3>
            </div>

            <div class="sub_tabs_container <%= params[:current_tab] -%>">
              <ul>
                <li id="settings"><%= link_to 'Stage Settings', admin_stage_edit_path(:current_tab => "settings") %></li>
                <li id="jobs"><%= link_to 'Jobs', admin_job_listing_path(:current_tab => "jobs") %></li>
                <li id="environment_variables"><%= link_to 'Environment Variables', admin_stage_edit_path(:current_tab => "environment_variables") %></li>
                <li id="permissions"><%= link_to 'Permissions', admin_stage_edit_path(:current_tab => "permissions") %></li>
              </ul>
            </div>
            <div id="form_parent">
              <%= render :partial => "admin/shared/global_errors.html", :locals => {:scope => {}} -%>
              <%= yield %>
            </div>
          </div>

          <%= render :partial => "admin/shared/dirty_form", :locals => {:scope => {:form_id => 'stage_edit_form', :reset_id => "reset_form"}} %>
          <div>
            <%= end_content_wrapper %>
          </div>


        </div>
      </div>
    </div>
  </div>
</div>
<%= render :partial => 'navigation_elements/footer' %>
</body>

<script type="text/javascript">
  jQuery(document).ready(function () {
    if (<%= @is_config_repo_pipeline || false %>) {
      Util.disableAllFormElementsFor(".admin_wrapper");
    }
  });
</script>

<% unless @in_pipeline_group_edit %>
    <script type="text/javascript">
      AjaxRefreshers.addRefresher(new AjaxRefresher("<%= pause_info_refresh_path(:pipeline_name => @pipeline.name()) -%>"), true);
    </script>
<% end %>
</html>

